<template>
  <div id="cart-list">
    <div v-if="cartList.length != 0">
      <CartListItem v-for="(item,index) in cartList" :key="index" :product="item" />
    </div>
    <div v-else>
      <div class="placeholder">购物车是空的</div>
    </div>
  </div>
</template>

<script>
import CartListItem from "./CartListItem";

import { mapGetters } from "vuex";

export default {
  name: "cart-list",
  computed: {
    ...mapGetters(["cartList"])
  },
  components: {
    CartListItem
  }
};
</script>

<style scoped>
.placeholder {
  height: 80px;
  line-height: 80px;
  color: #333;
  text-align: center;
  border-bottom: 1px solid #f1f1f1;
}
</style>